
import 'package:flutter/foundation.dart';
import 'package:get/get.dart';
import 'package:library_base/entities/enum_entity.dart';

class DeviceUtil {
  static bool get isDesktop => !isWeb && (isWindows || isLinux || isMacOS);
  static bool get isMobile => isAndroid || isIOS;
  static bool get isWeb => kIsWeb;

  static bool get isWindows => (defaultTargetPlatform == TargetPlatform.windows);
  static bool get isLinux => (defaultTargetPlatform == TargetPlatform.linux);
  static bool get isMacOS => (defaultTargetPlatform == TargetPlatform.macOS);
  static bool get isAndroid => (defaultTargetPlatform == TargetPlatform.android);
  static bool get isFuchsia => (defaultTargetPlatform == TargetPlatform.fuchsia);
  static bool get isIOS => (defaultTargetPlatform == TargetPlatform.iOS);

  static AppPlatform getPlatform(){
    if(GetPlatform.isAndroid){
      return AppPlatform.android;
    }else if(GetPlatform.isIOS){
      return AppPlatform.iOS;
    }else if(kIsWeb){
      return AppPlatform.web;
    }else if(GetPlatform.isWindows){
      return AppPlatform.windows;
    }else if(GetPlatform.isMacOS){
      return AppPlatform.macOS;
    }else if(GetPlatform.isFuchsia){
      return AppPlatform.fuchsia;
    }else if(GetPlatform.isLinux){
      return AppPlatform.linux;
    }
    return AppPlatform.android;
  }

}